home *** CD-ROM | disk | FTP | other *** search
/ Developer Source 8 / developer source - volume 8.iso / sdevl / oct95 / 1p72.gif next >
Graphics Interchange Format  |  1997-01-14  |  159KB  |  839x976  |  4-bit (15 colors)
Labels: text | screenshot | font | number | parallel | document
OCR: Identifying Objects Just like rows in a table need to have unique identifiers called keys, objects need unique identifiers called object IDs (OIDs). A common implementation for OIDs is to use integer numbers. The following chart describes the four basic approaches to assigning OIDs to objects. Strategy Implementation Advantages Disadvantages Class-wide All objects of a single Using an integer number Very simple to do. Polymorphism kills this OIDS class are assigned a for the OID, you take the approach almost instantly. unique OID within the maximum value within the For example, it's possible to scope of its class, This is OID column of your table have employee #1234 and similar to the concept that and add one to it. customer #1234. If you hire each row in a table has Fortunately, most DBMSs customer #1234, you need to a unique key. perform the MAX function reassign that person a new on a field key very efficiently. OID and update all other records involved in relationships with this person appropriately. Good luck. Hierarchy-wide All objects within a single The MAX function may still This is probably the most Depending on your database OIDs class hierarchy are work if you have a common realistic approach, solving design, this is potentially a given a unique OID. Taking OID attribute across classes. the polymorphism problem. little more difficult to this approach, you will For example, Figures 4 and 5 Objects usually change implement. It also has the never have both a take this approach through type only within the scope advantage of appearing a customer #1234 and an the use of person OID. of their class hierarchy. little unusual at first, employee #1234. For Figure 3, we would need to |For example, customers especially to people who are keep track of the value for the may become employees, used to making keys unique next OID, requiring an extra but they'll never become only within a single table. table in our database. accounts. Organization- An object within an A single table is used to store | Guarantees unique OIDs Once again, this is a little wide CIDs organization has a unique the next OID to be assigned. between all objects within more difficult to do. DID When an object is created, an organization. Problems arise when two this table is read and updated. disparate organizations try to Unfortunately, due to heavy share objects between them. traffic on this table, this The object Scott Ambler is a technique doesn't work. customer of several banks, all A better approach is to use of which need to share blocks of perhaps 1,000 0IDs credit information about me. for a given class hierarchy Read and updates on the OID table are done only when the block of OIDs runs out, reducing the number of accesses Galactic Just like every person has A single organization is Most ideal approach, The required organization to OID a unique social security responsible for distributing allowing objects to be do this does not exist yet, number, every object would blocks of OIDs to other easily shared among and even if it did, this is have its own unique organizations that in organizations. a lot easier said than done. identifier. All organizations turn assign an OID to an would use the same OID to object at the point of its represent the same object, creation. irregardless of its role in their information systems.